<%--  sudokuRules. jsp --%>
<%@page contentType="text/html;charset=UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
	<title>Web Baesd Intelligent Tutoring System in Sudoku for Logic Training</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <%-- CSS is get from http://www.freelayouts.com/ --%>
    <link rel="stylesheet" type="text/css" href="css/default.css" title="default"/>
</head>

<script>
function hide() {
    document.getElementById("login").style.display = "none";
    document.getElementById("logout").style.display = "block";
}
</script>

<body>
    <jsp:include page='header.jsp'/>

    <% String loginFormURL =
               "http://144.214.121.25:8080/SudokuITSWebsite/login.jsp";
    String user = (String) session.getAttribute("user");

    if(user == null) {
        response.setHeader("Refresh", "3; URL=" + loginFormURL);
        out.println(
            "<div class=\"article_body\">" +
            "<p><h2>" +
            "You have not login and will be redirected to the login page after 3 seconds. If not, press<a href=\"login.jsp\">here</a><br/>" +
            "您還沒登入！3秒後進入登入頁面.如沒有，請按<a href=\"login.jsp\">此</a><br/>" +
            "</h2></p>" +
            "</div>");
    }else{

    %>


        <div class="article_body">
            <p>
                <h2>Interpretation of Single In Group</h2><br/>
                Single In Group (SIG) is the simplest logical rules among the others. 
                The rules is formed based on the constraint that cells in the same scope 
                should only accommodate digit from one to nine exactly once. Take the row 
                covered with blue border in the following figure as an example. 
                Digits 1, 2,3,4,5,6,7,8 have already accommodated by the cells of row 2.
                Therefore, the remaining cell (cell (2, B))should accommodate digit 9.
                Similarly, the rules are also capable to solve the puzzle in column and box
                if they under the same precondition (There are already eight cells in the
                same scope have a declared value).
                <br/>
                <img src="img/SIG.jpg"/>
                <br/>
            </p>

             <p>
                <h2>Interpretation of Hidden Single</h2><br/>
                Hidden Single (HS) is another logical rule for declaration.
                It works whenever a digit is only possible for one cell in the same scope.
                Take the following figure as an example to illustrate the rules.
                In the box covered by blue border, there are three unsolved cells
                including cell (4, A), cell (4, B) and cell (6,A). Because of the cell shaded in
                orange (cell (9, A)) contain a digit 9.
                Therefore, only one cell (cell (4, B)) is capable to accommodate the digit 9 in the box.
                <br/>
                <img src="img/HS.jpg"/>
                <br/>
            </p>

            <p>
                <h2>Interpretation of Naked Single</h2><br/>
                Naked Single (NS) is considered as the most difficult declaration rule
                among others. However, this rule would be simple if elimination tools
                if provided. The following figure demonstrates a typical Sudoku puzzle and
                it is used to interpret the NS.Cell(5,E) (shaded in orange) is the Naked Single
                since there is only one possible value can placed in this cell.
                To find out the only possible digit of the cell, the digits appeared
                in the same scope with it is considered. Firstly, it is found that
                in Row 5, digits 2, 6, 7 are occupied. Secondly, digits 3, 4, 8, 9
                are appeared in Column E. Thirdly, digits 3, 5, 7 have been used in Box 5.
                In order words, digits 2, 3, 4, 5, 6, 7, 8, 9 are accommodated in the cells
                of same scope. Only digit 1 can be accommodated by Cell (5, E).
                <br/>
                <img src="img/NS.jpg"/>
                <br/>
            </p>

            <p>
                <h2>Interpretation of Intersection Reduction</h2><br/>
               Intersection Reduction (IR) is the first elimination
               rule that we have discussed so far. It is impossible to solve all
               the Sudoku puzzles by using declaration rules alone. Intersection
               reduction is a significant logical rule in solving most of the non-trivial
               Sudoku puzzles. The following figure shows a sample puzzle for the interpretation of
               this useful technique.Possible digits for the unsolved cells in row 2 include
               1, 6, 7, 8 and 9. However, digit 7 is only possible for cell
               (2, G) and cell (2, H) which belong to the same box (Box 3).
               Therefore, digit 7 should either be the definite value of cell (2, G)
               or cell (2, H). In other words, unsolved cells in Box 3 excluding cell
               (2, G) and cell (2, H) are impossible to accommodate digit 7.  Thereby,
               digit 7 is eliminated its possibility from cell (3, G) and cell (3, H).
                <br/>
                <img src="img/IR.jpg"/>
                <br/>
            </p>

            <p>
                <h2>Interpretation of Naked Pairs</h2><br/>
               Naked Pairs (NP) is an elimination technique that is considered to
               be simple to trace it out. It is because one of the conditions of
               applying NP is that pairs of possible values should be found in the
               same scope. The following figure shows a sample Sudoku puzzle in which NP can apply.
               NP can apply only if there are two possible values for a pair of cells
               in the same row or same column. In the sample provided, Cell (5,G) and Cell
               (5, H) , which are of the same row (Row 5), only contains digits 3 and
               4 as their possible value. It indicate that digit 3 is the definite value
               of Cell (5,G) and digit 3 is the definite value of Cell (5,H) or vice verse.
               In other words, other unsolved cells of the Row 5 are impossible to
               accommodate digit 3 and 4. Therefore, in this case, the digit 4 should eliminate
               its possibility in cell (5, A), cell (5, C) and cell (5, D).
                <br/>
                <img src="img/NP.jpg"/>
                <br/>
            </p>

             <p>
                <h2>Interpretation of Hidden Pairs</h2><br/>
              Hidden Pairs (HP) is the most difficult elimination rule
              and the most complex rule among those will be implemented
              in this project. HP work if a hidden pairs is found in a row
              or column. The following figure demonstrates a sample Sudoku puzzle
              in which a hidden pairs (Shaded in Orange) is found. Hidden pairs are
              formed when a pair of cells that contains at two same possible digits
              and there is no other unsolved cells in the same row or column containing
              that pairs of digits. Cell (2, C) and Cell (4, C) are a typical sample of
              hidden pairs. In this case, the digit involved should be digits 2 and 4.
              Since digits 2 and 4 can only be accommodated either in Cell (2, C) or Cell
              (4, C). Therefore, other digits of these two cells, i.e. digits 1 and 3 in
              Cell (2, C) should be eliminated.
                <br/>
                <img src="img/HP.jpg"/>
                <br/>
            </p>
        </div>


    <%
        }
    %>

     <jsp:include page='footer.jsp'/>
</body>
</html>

